﻿using System;
using System.Threading;
namespace ConsoleApp2
{
    public delegate void EventHandler();
    public class Clock
    {
        public static double currentTime = 0;
        public double ringingTime { get; set; } = 0;
        public event EventHandler Tick;
        public event EventHandler Alarm;
        public void Start()
        {
            while (currentTime <= ringingTime)
            {
                Tick?.Invoke();
                if (currentTime == ringingTime)
                {
                    Alarm?.Invoke();
                    break;
                }
                currentTime += 1;
                Thread.Sleep(1000);
            }
        }
    }
}
